<template>
  <div>
    <h1>$children</h1>
    <children-1 />
    <children-2 />
    <button @click="getChildren">获取子组件</button>
  </div>
</template>

<script>
import children1 from "./children1.vue";
import children2 from "./children2.vue";
export default {
  components: {
    children1,
    children2
  },
  methods: {
    getChildren() {
      console.log(this.$children);
      console.log(this.$children[0].title);
      console.log(this.$children[1].title);

      this.$children[0].handle();
      this.$children[1].handle();
    }
  }
};
</script>
